﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NewsMine.DomainObjects;
using Db4objects.Db4o;
using System.IO;

namespace NewsMine.FeedRepository
{
    public class DB4oWebSiteManager : NewsMine.FeedRepository.IWebSiteManager 
    {

       #region WebSiteInfo CRUD

        public WebSiteInfo AddWebSiteInfo(WebSiteInfo webSiteInfo)
        {
            using (IObjectContainer container = Db4oEmbedded.OpenFile(RepositoryConfiguration.TargetConfigDataFileName))
            {
                container.Store(webSiteInfo);

                webSiteInfo.ID = container.Ext().GetID(webSiteInfo);

                container.Store(webSiteInfo);

                webSiteInfo = (WebSiteInfo)container.Ext().GetByID(webSiteInfo.ID);
            }

            return webSiteInfo;
        }

        public bool SaveWebSiteInfo(WebSiteInfo webSiteInfo)
        {
            throw new NotImplementedException();
        }

        #endregion


        #region WebSiteInfo Query

        public WebSiteInfo GetWebSiteByID(long id)
        {
            using (IObjectContainer container = Db4oEmbedded.OpenFile(RepositoryConfiguration.TargetConfigDataFileName))
            {
                WebSiteInfo webSiteInfo = (WebSiteInfo)container.Ext().GetByID(id);

                container.Activate(webSiteInfo, 1);

                webSiteInfo.LocalName = "Surendra";

                container.Store(webSiteInfo);

                return webSiteInfo;
            }
        }


        public WebSiteInfo GetWebSitesByLanguage(Language language)
        {
            throw new NotImplementedException();
        }

        public List<WebSiteInfo> GetWebSitesByLanguageID(long languageId)
        {
            throw new NotImplementedException();
        }

        public List<WebSiteInfo> GetWebSitesByAuthor(AuthorInfo author)
        {
            throw new NotImplementedException();
        }

        public List<WebSiteInfo> GetWebSitesByAuthorID(long authorID)
        {
            throw new NotImplementedException();
        }


        public List<WebSiteInfo> GetWebSitesByCategory(Category category)
        {
            throw new NotImplementedException();
        }

        public List<WebSiteInfo> GetWebSitesByCategoryID(long categoryId)
        {
            throw new NotImplementedException();
        }

        public List<WebSiteInfo> GetWebSitesByGeoLocation(GeoLocation location)
        {
            throw new NotImplementedException();
        }

        public List<WebSiteInfo> GetWebSitesByGeoLocationID(long locationID)
        {
            throw new NotImplementedException();
        }

        public List<WebSiteInfo> GetWebSitesForUser(UserInfo userInfo)
        {
            throw new NotImplementedException();
        }

        public List<WebSiteInfo> SearchWebSitesByName(string name)
        {
            throw new NotImplementedException();
        }

        public List<WebSiteInfo> GetRelatedWebSites(WebSiteInfo websiteInfo)
        {
            throw new NotImplementedException();
            //this could be mix of the available inputs like language, geolocation and categories.

        }


        public List<WebSiteInfo> GetAllInactiveWebsites()
        {
            throw new NotImplementedException();
        }

        public List<WebSiteInfo> GetAllAdultWebSites()
        {
            throw new NotImplementedException();
        }


        public List<WebSiteInfo> GetWebSitesForCategoryHierarchy(Category category)
        {
            throw new NotImplementedException();
        }

        #endregion


        #region WebSiteMenu CRUD

        public WebSiteMenu AddWebMenuItem(WebSiteMenu webSiteMenu)
        {
            throw new NotImplementedException();
        }

        public bool SaveWebSiteMenu(WebSiteMenu websiteMenu)
        {
            throw new NotImplementedException();
        }


        #endregion

        #region WebSiteMenu Query

        public List<WebSiteMenu> GetMenuListByWebSite(WebSiteInfo websiteInfo)
        {
            throw new NotImplementedException();
        }

        public List<WebSiteMenu> GetMenuItemById(long webSiteMenuID)
        {
            throw new NotImplementedException();
        }

        #endregion


    }
}
